package com.linb.pan.server.common.utils;

import com.linb.pan.core.constants.BPanConstants;

public class UserIdUtil {

    private static ThreadLocal<Long> threadLocal = new ThreadLocal<>();

    public static void set(Long userId) {
        threadLocal.set(userId);
    }

    public static Long get() {
        Long userId = threadLocal.get();
        if (userId == null) {
            return BPanConstants.ZERO_LONG;
        }
        return userId;
    }

}
